/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.vod.gauss.operations;

/**
 * 
 * @author drazanakoto
 */
public class CorpsDeGalloisOperation implements Operation {

	private GF256 gf256;

	/**
     * 
     */
	public CorpsDeGalloisOperation() {
		gf256 = new GF256();
	}

	@Override
	public int addition(int a, int b) {
		return a ^ b;
	}

	@Override
	public int soustraction(int a, int b) {
		return addition(a, b);
	}

	@Override
	public int multiplication(int a, int b) {
		return gf256.multiplication(a, b);
	}

	@Override
	public int division(int a, int b) throws ArithmeticException {
		if (b == 0) {
			throw new ArithmeticException();
		}
		return gf256.division(a, b);
	}
}
